package cs470.kalman;

import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;

import javax.swing.JPanel;

public class KalmanPanel extends JPanel {
	private static final long serialVersionUID = 1L;

	private BufferedImage image;
	private BufferedImage image2;

	private int count = 0;

	public KalmanPanel(boolean transparent) {
		
	}
	
	public void paint(Graphics g) {
		super.paint(g);
		g.clearRect(0, 0, getWidth(), getHeight());
		if(image != null && image2 != null) {

			g.drawImage(image, 0, 0, null);
			
			g.setColor(Color.WHITE);
			g.fillRect(470, 0, 150, 385);
			
			((Graphics2D) g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .3f));
			g.drawImage(image2, 0, 0, null);
			
		} else {
			g.drawString(Integer.toString(count++), 50, 50);
		}
	}
	
	public void setImage(BufferedImage image, BufferedImage image2) {
		this.image = image;
		this.image2 = image2;
		this.repaint();
	}
	
}
